jQuery(function($){

	$('.index').click(function(){
		location.href = "../index.html"
	})
	$(".fresh").click(function(){
        location.href="../html/fresh.html"
    })
	$('.mine').click(function(){
		location.href = "mine.html"
	})
	$("._right").click(function(){
		location.href="sousuo.html"
	})
	$("._center").click(function(){
		location.href="region.html"
	})
	
	
	var Swiper_active1 = $('.content .swiper-container-list .active-nav')
	,	Swiper_slide1 = $('.swiper-container-list .swiper-slide');
	var _mySwiperlist = new Swiper('.swiper-container-list', {
		watchSlidesProgress: true,
		watchSlidesVisibility: true,
		slidesPerView: 6,
		onTap: function() {
			_mySwiperopts.slideTo(_mySwiperlist.clickedIndex)
		}
	})
	var _mySwiperopts = new Swiper('.swiper-container-opts', {
		onSlideChangeStart: function() {
			updateNavPosition(Swiper_active1, Swiper_slide1, _mySwiperopts, _mySwiperlist)
		}
	})

	function updateNavPosition(Swiper_active, Swiper_slide, mySwiper, mySwiper_list) {
		Swiper_active.removeClass('active-nav')
		var activeNav = Swiper_slide.eq(mySwiper.activeIndex).addClass('active-nav');
		activeNav.siblings().removeClass("active-nav");
		if(!activeNav.hasClass('swiper-slide-visible')) {
			if(activeNav.index() > mySwiper_list.activeIndex) {
				var thumbsPerNav = Math.floor(mySwiper_list.width / activeNav.width()) - 1
				mySwiper_list.slideTo(activeNav.index() - thumbsPerNav)
			} else {
				mySwiper_list.slideTo(activeNav.index())
			}
		}
	}



    var swiper = new Swiper('.region .swiper-container', {
        pagination: '.swiper-pagination',
        slidesPerView: 3,
        paginationClickable: true,
        spaceBetween: 30,
        freeMode: true
    });
});